home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / dejagnu.lha / dejagnu-1.0.1 / tcl / tcl.h < prev    next >
C/C++ Source or Header  |  1993-02-14  |  12KB  |  365 lines

  1. /*
  2.  * tcl.h --
  3.  *
  4.  *    This header file describes the externally-visible facilities
  5.  *    of the Tcl interpreter.
  6.  *
  7.  * Copyright 1987-1991 Regents of the University of California
  8.  * Permission to use, copy, modify, and distribute this
  9.  * software and its documentation for any purpose and without
  10.  * fee is hereby granted, provided that the above copyright
  11.  * notice appear in all copies.  The University of California
  12.  * makes no representations about the suitability of this
  13.  * software for any purpose.  It is provided "as is" without
  14.  * express or implied warranty.
  15.  *
  16.  */
  17.  
  18. #ifndef _TCL
  19. #define _TCL
  20.  
  21. #define TCL_VERSION "6.7"
  22. #define TCL_MAJOR_VERSION 6
  23. #define TCL_MINOR_VERSION 7
  24.  
  25. /*
  26.  * Definitions that allow this header file to be used either with or
  27.  * without ANSI C features like function prototypes.
  28.  */
  29.  
  30. #undef _ANSI_ARGS_
  31. #undef const
  32. #if ((defined(__STDC__) || defined(SABER)) && !defined(NO_PROTOTYPE)) || defined(__cplusplus)
  33. #   define _ANSI_ARGS_(x)    x
  34. #   define CONST const
  35. #   ifdef __cplusplus
  36. #       define VARARGS (...)
  37. #   else
  38. #       define VARARGS ()
  39. #   endif
  40. #else
  41. #   define _ANSI_ARGS_(x)    ()
  42. #   define CONST
  43. #endif
  44.  
  45. #ifdef __cplusplus
  46. #   define EXTERN extern "C"
  47. #else
  48. #   define EXTERN extern
  49. #endif
  50.  
  51. /*
  52.  * Macro to use instead of "void" for arguments that must have
  53.  * type "void *" in ANSI C;  maps them to type "char *" in
  54.  * non-ANSI systems.
  55.  */
  56.  
  57. #ifndef VOID
  58. #   ifdef __STDC__
  59. #       define VOID void
  60. #   else
  61. #       define VOID char
  62. #   endif
  63. #endif
  64.  
  65. /*
  66.  * Miscellaneous declarations (to allow Tcl to be used stand-alone,
  67.  * without the rest of Sprite).
  68.  */
  69.  
  70. #ifndef NULL
  71. #define NULL 0
  72. #endif
  73.  
  74. #ifndef _CLIENTDATA
  75. typedef int *ClientData;
  76. #define _CLIENTDATA
  77. #endif
  78.  
  79. /*
  80.  * Data structures defined opaquely in this module.  The definitions
  81.  * below just provide dummy types.  A few fields are made visible in
  82.  * Tcl_Interp structures, namely those for returning string values.
  83.  * Note:  any change to the Tcl_Interp definition below must be mirrored
  84.  * in the "real" definition in tclInt.h.
  85.  */
  86.  
  87. typedef struct Tcl_Interp{
  88.     char *result;        /* Points to result string returned by last
  89.                  * command. */
  90.     void (*freeProc) _ANSI_ARGS_((char *blockPtr));
  91.                 /* Zero means result is statically allocated.
  92.                  * If non-zero, gives address of procedure
  93.                  * to invoke to free the result.  Must be
  94.                  * freed by Tcl_Eval before executing next
  95.                  * command. */
  96.     int errorLine;        /* When TCL_ERROR is returned, this gives
  97.                  * the line number within the command where
  98.                  * the error occurred (1 means first line). */
  99. } Tcl_Interp;
  100.  
  101. typedef int *Tcl_Trace;
  102. typedef int *Tcl_CmdBuf;
  103.  
  104. /*
  105.  * When a TCL command returns, the string pointer interp->result points to
  106.  * a string containing return information from the command.  In addition,
  107.  * the command procedure returns an integer value, which is one of the
  108.  * following:
  109.  *
  110.  * TCL_OK        Command completed normally;  interp->result contains
  111.  *            the command's result.
  112.  * TCL_ERROR        The command couldn't be completed successfully;
  113.  *            interp->result describes what went wrong.
  114.  * TCL_RETURN        The command requests that the current procedure
  115.  *            return;  interp->result contains the procedure's
  116.  *            return value.
  117.  * TCL_BREAK        The command requests that the innermost loop
  118.  *            be exited;  interp->result is meaningless.
  119.  * TCL_CONTINUE        Go on to the next iteration of the current loop;
  120.  *            interp->result is meaninless.
  121.  */
  122.  
  123. #define TCL_OK        0
  124. #define TCL_ERROR    1
  125. #define TCL_RETURN    2
  126. #define TCL_BREAK    3
  127. #define TCL_CONTINUE    4
  128.  
  129. #define TCL_RESULT_SIZE 199
  130.  
  131. /*
  132.  * Procedure types defined by Tcl:
  133.  */
  134.  
  135. typedef void (Tcl_CmdDeleteProc) _ANSI_ARGS_((ClientData clientData));
  136. typedef int (Tcl_CmdProc) _ANSI_ARGS_((ClientData clientData,
  137.     Tcl_Interp *interp, int argc, char *argv[]));
  138. typedef void (Tcl_CmdTraceProc) _ANSI_ARGS_((ClientData clientData,
  139.     Tcl_Interp *interp, int level, char *command, Tcl_CmdProc *proc,
  140.     ClientData cmdClientData, int argc, char *argv[]));
  141. typedef void (Tcl_FreeProc) _ANSI_ARGS_((char *blockPtr));
  142. typedef char *(Tcl_VarTraceProc) _ANSI_ARGS_((ClientData clientData,
  143.     Tcl_Interp *interp, char *part1, char *part2, int flags));
  144.  
  145. /*
  146.  * Flag values passed to Tcl_Eval (see the man page for details;  also
  147.  * see tclInt.h for additional flags that are only used internally by
  148.  * Tcl):
  149.  */
  150.  
  151. #define TCL_BRACKET_TERM    1
  152.  
  153. /*
  154.  * Flag that may be passed to Tcl_ConvertElement to force it not to
  155.  * output braces (careful!  if you change this flag be sure to change
  156.  * the definitions at the front of tclUtil.c).
  157.  */
  158.  
  159. #define TCL_DONT_USE_BRACES    1
  160.  
  161. /*
  162.  * Flag value passed to Tcl_RecordAndEval to request no evaluation
  163.  * (record only).
  164.  */
  165.  
  166. #define TCL_NO_EVAL        -1
  167.  
  168. /*
  169.  * Specil freeProc values that may be passed to Tcl_SetResult (see
  170.  * the man page for details):
  171.  */
  172.  
  173. #define TCL_VOLATILE    ((Tcl_FreeProc *) -1)
  174. #define TCL_STATIC    ((Tcl_FreeProc *) 0)
  175. #define TCL_DYNAMIC    ((Tcl_FreeProc *) free)
  176.  
  177. /*
  178.  * Flag values passed to variable-related procedures.
  179.  */
  180.  
  181. #define TCL_GLOBAL_ONLY        1
  182. #define TCL_APPEND_VALUE    2
  183. #define TCL_LIST_ELEMENT    4
  184. #define TCL_NO_SPACE        8
  185. #define TCL_TRACE_READS        0x10
  186. #define TCL_TRACE_WRITES    0x20
  187. #define TCL_TRACE_UNSETS    0x40
  188. #define TCL_TRACE_DESTROYED    0x80
  189. #define TCL_INTERP_DESTROYED    0x100
  190. #define TCL_LEAVE_ERR_MSG    0x200
  191.  
  192. /*
  193.  * Additional flag passed back to variable watchers.  This flag must
  194.  * not overlap any of the TCL_TRACE_* flags defined above or the
  195.  * TRACE_* flags defined in tclInt.h.
  196.  */
  197.  
  198. #define TCL_VARIABLE_UNDEFINED    8
  199.  
  200. /*
  201.  * The following declarations either map ckalloc and ckfree to
  202.  * malloc and free, or they map them to procedures with all sorts
  203.  * of debugging hooks defined in tclCkalloc.c.
  204.  */
  205.  
  206. #ifdef TCL_MEM_DEBUG
  207.  
  208. EXTERN char *        Tcl_DbCkalloc _ANSI_ARGS_((unsigned int size,
  209.                 char *file, int line));
  210. EXTERN int        Tcl_DbCkfree _ANSI_ARGS_((char *ptr,
  211.                 char *file, int line));
  212. EXTERN char *        Tcl_DbCkrealloc _ANSI_ARGS_((char *ptr,
  213.                 unsigned int size, char *file, int line));
  214. EXTERN int        Tcl_DumpActiveMemory _ANSI_ARGS_((char *fileName));
  215. EXTERN void        Tcl_ValidateAllMemory _ANSI_ARGS_((char *file,
  216.                 int line));
  217. #  define ckalloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__)
  218. #  define ckfree(x)  Tcl_DbCkfree(x, __FILE__, __LINE__)
  219. #  define ckrealloc(x,y) Tcl_DbCkrealloc((x), (y),__FILE__, __LINE__)
  220.  
  221. #else
  222.  
  223. #  define ckalloc(x) malloc(x)
  224. #  define ckfree(x)  free(x)
  225. #  define ckrealloc(x,y) realloc(x,y)
  226. #  define Tcl_DumpActiveMemory(x)
  227. #  define Tcl_ValidateAllMemory(x,y)
  228.  
  229. #endif /* TCL_MEM_DEBUG */
  230.  
  231. /*
  232.  * Macro to free up result of interpreter.
  233.  */
  234.  
  235. #define Tcl_FreeResult(interp)                    \
  236.     if ((interp)->freeProc != 0) {                \
  237.     if ((interp)->freeProc == (Tcl_FreeProc *) free) {    \
  238.         ckfree((interp)->result);                \
  239.     } else {                        \
  240.         (*(interp)->freeProc)((interp)->result);        \
  241.     }                            \
  242.     (interp)->freeProc = 0;                    \
  243.     }
  244.  
  245. /*
  246.  * Exported Tcl procedures:
  247.  */
  248.  
  249. EXTERN void        Tcl_AppendElement _ANSI_ARGS_((Tcl_Interp *interp,
  250.                 char *string, int noSep));
  251. EXTERN void        Tcl_AppendResult _ANSI_ARGS_(VARARGS);
  252. EXTERN char *        Tcl_AssembleCmd _ANSI_ARGS_((Tcl_CmdBuf buffer,
  253.                 char *string));
  254. EXTERN void        Tcl_AddErrorInfo _ANSI_ARGS_((Tcl_Interp *interp,
  255.                 char *message));
  256. EXTERN char        Tcl_Backslash _ANSI_ARGS_((char *src,
  257.                 int *readPtr));
  258. EXTERN int        Tcl_CommandComplete _ANSI_ARGS_((char *cmd));
  259. EXTERN char *        Tcl_Concat _ANSI_ARGS_((int argc, char **argv));
  260. EXTERN int        Tcl_ConvertElement _ANSI_ARGS_((char *src,
  261.                 char *dst, int flags));
  262. EXTERN Tcl_CmdBuf    Tcl_CreateCmdBuf _ANSI_ARGS_((void));
  263. EXTERN void        Tcl_CreateCommand _ANSI_ARGS_((Tcl_Interp *interp,
  264.                 char *cmdName, Tcl_CmdProc *proc,
  265.                 ClientData clientData,
  266.                 Tcl_CmdDeleteProc *deleteProc));
  267. EXTERN Tcl_Interp *    Tcl_CreateInterp _ANSI_ARGS_((void));
  268. EXTERN int        Tcl_CreatePipeline _ANSI_ARGS_((Tcl_Interp *interp,
  269.                 int argc, char **argv, int **pidArrayPtr,
  270.                 int *inPipePtr, int *outPipePtr,
  271.                 int *errFilePtr));
  272. EXTERN Tcl_Trace    Tcl_CreateTrace _ANSI_ARGS_((Tcl_Interp *interp,
  273.                 int level, Tcl_CmdTraceProc *proc,
  274.                 ClientData clientData));
  275. EXTERN void        Tcl_DeleteCmdBuf _ANSI_ARGS_((Tcl_CmdBuf buffer));
  276. EXTERN int        Tcl_DeleteCommand _ANSI_ARGS_((Tcl_Interp *interp,
  277.                 char *cmdName));
  278. EXTERN void        Tcl_DeleteInterp _ANSI_ARGS_((Tcl_Interp *interp));
  279. EXTERN void        Tcl_DeleteTrace _ANSI_ARGS_((Tcl_Interp *interp,
  280.                 Tcl_Trace trace));
  281. EXTERN void        Tcl_DetachPids _ANSI_ARGS_((int numPids, int *pidPtr));
  282. EXTERN char *        Tcl_ErrnoId _ANSI_ARGS_((void));
  283. EXTERN int        Tcl_Eval _ANSI_ARGS_((Tcl_Interp *interp, char *cmd,
  284.                 int flags, char **termPtr));
  285. EXTERN int        Tcl_EvalFile _ANSI_ARGS_((Tcl_Interp *interp,
  286.                 char *fileName));
  287. EXTERN int        Tcl_ExprBoolean _ANSI_ARGS_((Tcl_Interp *interp,
  288.                 char *string, int *ptr));
  289. EXTERN int        Tcl_ExprDouble _ANSI_ARGS_((Tcl_Interp *interp,
  290.                 char *string, double *ptr));
  291. EXTERN int        Tcl_ExprLong _ANSI_ARGS_((Tcl_Interp *interp,
  292.                 char *string, long *ptr));
  293. EXTERN int        Tcl_ExprString _ANSI_ARGS_((Tcl_Interp *interp,
  294.                 char *string));
  295. EXTERN int        Tcl_Fork _ANSI_ARGS_((void));
  296. EXTERN int        Tcl_GetBoolean _ANSI_ARGS_((Tcl_Interp *interp,
  297.                 char *string, int *boolPtr));
  298. EXTERN int        Tcl_GetDouble _ANSI_ARGS_((Tcl_Interp *interp,
  299.                 char *string, double *doublePtr));
  300. EXTERN int        Tcl_GetInt _ANSI_ARGS_((Tcl_Interp *interp,
  301.                 char *string, int *intPtr));
  302. EXTERN char *        Tcl_GetVar _ANSI_ARGS_((Tcl_Interp *interp,
  303.                 char *varName, int flags));
  304. EXTERN char *        Tcl_GetVar2 _ANSI_ARGS_((Tcl_Interp *interp,
  305.                 char *part1, char *part2, int flags));
  306. EXTERN int        Tcl_GlobalEval _ANSI_ARGS_((Tcl_Interp *interp,
  307.                 char *command));
  308. EXTERN void        Tcl_InitHistory _ANSI_ARGS_((Tcl_Interp *interp));
  309. EXTERN void        Tcl_InitMemory _ANSI_ARGS_((Tcl_Interp *interp));
  310. EXTERN char *        Tcl_Merge _ANSI_ARGS_((int argc, char **argv));
  311. EXTERN char *        Tcl_ParseVar _ANSI_ARGS_((Tcl_Interp *interp,
  312.                 char *string, char **termPtr));
  313. EXTERN int        Tcl_RecordAndEval _ANSI_ARGS_((Tcl_Interp *interp,
  314.                 char *cmd, int flags));
  315. EXTERN void        Tcl_ResetResult _ANSI_ARGS_((Tcl_Interp *interp));
  316. #define Tcl_Return Tcl_SetResult
  317. EXTERN int        Tcl_ScanElement _ANSI_ARGS_((char *string,
  318.                 int *flagPtr));
  319. EXTERN void        Tcl_SetErrorCode _ANSI_ARGS_(VARARGS);
  320. EXTERN void        Tcl_SetResult _ANSI_ARGS_((Tcl_Interp *interp,
  321.                 char *string, Tcl_FreeProc *freeProc));
  322. EXTERN char *        Tcl_SetVar _ANSI_ARGS_((Tcl_Interp *interp,
  323.                 char *varName, char *newValue, int flags));
  324. EXTERN char *        Tcl_SetVar2 _ANSI_ARGS_((Tcl_Interp *interp,
  325.                 char *part1, char *part2, char *newValue,
  326.                 int flags));
  327. EXTERN char *        Tcl_SignalId _ANSI_ARGS_((int sig));
  328. EXTERN char *        Tcl_SignalMsg _ANSI_ARGS_((int sig));
  329. EXTERN int        Tcl_SplitList _ANSI_ARGS_((Tcl_Interp *interp,
  330.                 char *list, int *argcPtr, char ***argvPtr));
  331. EXTERN int        Tcl_StringMatch _ANSI_ARGS_((char *string,
  332.                 char *pattern));
  333. EXTERN char *        Tcl_TildeSubst _ANSI_ARGS_((Tcl_Interp *interp,
  334.                 char *name));
  335. EXTERN int        Tcl_TraceVar _ANSI_ARGS_((Tcl_Interp *interp,
  336.                 char *varName, int flags, Tcl_VarTraceProc *proc,
  337.                 ClientData clientData));
  338. EXTERN int        Tcl_TraceVar2 _ANSI_ARGS_((Tcl_Interp *interp,
  339.                 char *part1, char *part2, int flags,
  340.                 Tcl_VarTraceProc *proc, ClientData clientData));
  341. EXTERN char *        Tcl_UnixError _ANSI_ARGS_((Tcl_Interp *interp));
  342. EXTERN int        Tcl_UnsetVar _ANSI_ARGS_((Tcl_Interp *interp,
  343.                 char *varName, int flags));
  344. EXTERN int        Tcl_UnsetVar2 _ANSI_ARGS_((Tcl_Interp *interp,
  345.                 char *part1, char *part2, int flags));
  346. EXTERN void        Tcl_UntraceVar _ANSI_ARGS_((Tcl_Interp *interp,
  347.                 char *varName, int flags, Tcl_VarTraceProc *proc,
  348.                 ClientData clientData));
  349. EXTERN void        Tcl_UntraceVar2 _ANSI_ARGS_((Tcl_Interp *interp,
  350.                 char *part1, char *part2, int flags,
  351.                 Tcl_VarTraceProc *proc, ClientData clientData));
  352. EXTERN int        Tcl_VarEval _ANSI_ARGS_(VARARGS);
  353. EXTERN ClientData    Tcl_VarTraceInfo _ANSI_ARGS_((Tcl_Interp *interp,
  354.                 char *varName, int flags,
  355.                 Tcl_VarTraceProc *procPtr,
  356.                 ClientData prevClientData));
  357. EXTERN ClientData    Tcl_VarTraceInfo2 _ANSI_ARGS_((Tcl_Interp *interp,
  358.                 char *part1, char *part2, int flags,
  359.                 Tcl_VarTraceProc *procPtr,
  360.                 ClientData prevClientData));
  361. EXTERN int        Tcl_WaitPids _ANSI_ARGS_((int numPids, int *pidPtr,
  362.                 int *statusPtr));
  363.  
  364. #endif /* _TCL */
  365.